package edu.webarchitechture.bank.ejb3.services;

import edu.webarchitechture.bank.ejb3.domain.Tx;
import edu.webarchitechture.bank.ejb3.exception.*;

import javax.ejb.Local;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Local
public interface TransactionManager {

    void deposit(BigDecimal amount, String description, Long accountId)
            throws InvalidParameterException, AccountNotFoundException, IllegalAccountTypeException;

    Tx getTransaction(Long txId) throws TxNotFoundException, InvalidParameterException;

    List<Tx> getTxsOfAccount(Date startDate, Date endDate, Long accountId) throws InvalidParameterException;

    void makeCharge(BigDecimal amount, String description, Long accountId)
            throws InvalidParameterException, AccountNotFoundException, IllegalAccountTypeException, InsufficientCreditException;

    void makePayment(BigDecimal amount, String description, Long accountId)
            throws InvalidParameterException, AccountNotFoundException, IllegalAccountTypeException;

    void transferFunds(BigDecimal amount, String description, Long fromAccountId, Long toAccountId)
            throws InvalidParameterException, AccountNotFoundException, InsufficientFundsException, InsufficientCreditException;

    void withdraw(BigDecimal amount, String description, Long accountId)
            throws InvalidParameterException, AccountNotFoundException, IllegalAccountTypeException, InsufficientFundsException;
}
